# lst = [11, 24, 46, 78, 99, 345]
# n = int(input(">>>"))
# left = 0
# right = len(lst) - 1
# while left <= right:
#     mid = (left + right) // 2  # 整除2计算中间位置
#     if n > lst[mid]:
#         left = mid + 1
#     elif n < lst[mid]:
#         right = mid - 1
#     elif n == lst[mid]:
#         print("找到了该数据，位置是", mid)
#         break
# else:
#     print("没找到该数据")

#
# # 递归版本的二分法
# lst = [11, 24, 46, 78, 99, 345]
# n = int(input(">>>"))
# left = 0
# right = len(lst) - 1
#
#
# def find(lst, n, left, right):
#     if left > right:
#         print("没找到该数据")
#         return
#     mid = (left + right) // 2
#     if n > lst[mid]:
#         left = mid + 1
#     elif n < lst[mid]:
#         right = mid - 1
#     else:
#         print("找到了该数据，位置是", mid)
#         return
#     find(lst, n, left, right)  # 进入递归
#
#
# find(lst, n, left, right)
